import link from "@/api/link.js";
let life = {
    state: {
        //政府服务
        listobj: [],
        //二级---优惠---活动、优惠券
        huodongobj: [],
        //二级---我的缴费
        wodejiaofei: [],
        //二级---礼遇陕西
        liyushanxi: [],
    },
    mutations: {
        UPOBJ(state, payload) {
            state.listobj = payload;
        },
        HDONG(state, payload) {
            state.huodongobj = payload.data;
        },
        JAOFEI(state, payload) {
            state.wodejiaofei = payload.data;
        },
        LIYUSX(state, payload) {
            state.liyushanxi = payload.data;
        },
    },
    getters: {},
    actions: {
        LINK_DATA(context, payload) {
            // console.log(context);
            //
            link(payload.url).then(({ data }) => {
                console.log("hhhhhhhhh", data);
                context.commit("UPOBJ", data.zffwData);
            });
        },
        HUOD_DATA(context, payload) {
            // console.log(context);
            //
            link(payload.url).then(({ data }) => {
                // console.log(data);
                context.commit("HDONG", { data });
            });
        },
        JAOFEI_DATA(context, payload) {
            // console.log(context);
            //
            link(payload.url).then(({ data }) => {
                // console.log(data);
                context.commit("JAOFEI", { data });
            });
        },
        LIYUSHANXI_DATA(context, payload) {
            // console.log(context);
            //
            link(payload.url).then(({ data }) => {
                // console.log(data);
                context.commit("LIYUSX", { data });
            });
        },
    },
};

export default life;